import * as React from "react";
import * as ReactDom from "react-dom";
import "../static/css/index";
import App from "./components/App";
import {composeWithDevTools} from "redux-devtools-extension";
import {rootReducer} from "@/store";
import {createStore} from "redux";
import {Provider} from "react-redux";
import EventEmitter from "@/utils/event-emitter/EventEmitter";
import "./mock/mockText";

let eventEmitter = new EventEmitter();


eventEmitter.on("event", (item) => {
    console.log(item);
});

const emitItem = () => {
    console.log("666")
};
eventEmitter.on("event", emitItem);

eventEmitter.once("event1", emitItem);

eventEmitter.emit("event", "000");
eventEmitter.emit("event1");


eventEmitter.off("event", emitItem);
console.log(eventEmitter);
export const store = createStore(rootReducer, composeWithDevTools());

store.subscribe(() => {
    console.log(store.getState(), "更新了")
});

ReactDom.render(
    <Provider store={store}>
        <App/>
     </Provider>,
    document.getElementById("app") as HTMLElement
);
